﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Fitment.User
{
    public partial class modifyPwd : System.Web.UI.Page
    {
        Userinfo user = new Userinfo();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            user.Id = Convert.ToInt32(Session["User_ID"].ToString());
            string oldPwd = tb_old.Text.ToString().Trim();
            string newPwd1 = tb_new1.Text.ToString().Trim();
            if (user.modifyPwd(oldPwd, newPwd1) == 1)
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "提示", "<script>alert('密码修改成功！');</script>");
            }
            else if (user.modifyPwd(oldPwd, newPwd1) == 0)
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "提示", "<script>alert('密码修改不成功！');</script>");
            }
            else if (user.modifyPwd(oldPwd, newPwd1) == 2)
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "提示", "<script>alert('原密码输入不正确！');</script>");
            }
            else { }
        }
    }
}
